<template>
  <a-card :bordered='false'>
    <search :config='searchConfig' @search='search' @getHeight='getHeight' />
    <div class='page_table'>
      <vxe-grid
        ref='xGrid'
        :border='true'
        :resizable='true'
        :showOverflow='true'
        size='mini'
        :loading='loading'
        :height='pageHeight-seachHeight-94'
        :align='left'
        :columns='columns'
        :data='dataSource'
        :checkbox-config="checkboxConfig"
        v-bind='vexConfig'
        @checkbox-change='selectChangeEvent'
        @checkbox-all='selectChangeEvent'
      >
        <!--        :toolbar-config='tableToolbar'-->
        <!--        <template #toolbar_buttons>-->
        <!--          <div class='table-operator'>-->
        <!--            <a-button v-has="'business:log'" href='javascript:;' @click='handleBusiness("客户反馈")'>日志</a-button>-->
        <!--          </div>-->
        <!--        </template>-->
        <template #detail='{ row,rowIndex }'>
          <a @click='handleDetail(row)'>{{ row.workOrderCode }}</a>
        </template>
        <template #problemType='{ row,rowIndex }'>
          {{ row.problemType==1?'订单问题':'其他问题' }}
        </template>
        <template #status='{ row,rowIndex }'>
          <span :style="{color:row.status==2?'blue':'red'}">{{ row.status==2?'已处理':'待处理' }}</span>
        </template>
        <template #action='{ row }'>
          <a v-if="row.status==1"  @click='handleEdit(row)'>审核</a>
          <a v-else  style="color: darkgray">审核</a>
          <a-divider type="vertical"/>
          <a v-has="'business:log'" href='javascript:;' @click='handleBusiness("客户反馈",row)'>日志</a>
        </template>
        <template #pager>
          <vxe-pager
            :layouts="['Total', 'PrevJump', 'PrevPage', 'Number', 'NextPage', 'NextJump','Sizes', 'FullJump']"
            :currentPage.sync='ipagination.current'
            :page-size.sync='ipagination.pageSize'
            :total='ipagination.total'
            :pageSizes='ipagination.pageSizeOptions'
            @page-change='handlePageChange'>
          </vxe-pager>
        </template>
      </vxe-grid>
    </div>
    <business-log ref='businessLog'></business-log>
    <client-feedback-modal ref="modalForm" @ok="modalFormOk"></client-feedback-modal>
  </a-card>
</template>

<script>
import ClientFeedbackModal from './modules/ClientFeedbackModal'
import { PageListMixin } from '@/mixins/PageListMixin'

export default {
  name: 'proMinPrice',
  mixins: [PageListMixin],
  components: {
    ClientFeedbackModal
  },
  data() {
    return {
      description: '客户反馈',
      searchConfig: [
        {
          type: 'input',
          name: 'customerCode',
          placeholder: '客户编号'
        },
        {
          type: 'input',
          name: 'customerName',
          placeholder: '客户名称'
        },
        {
          type: 'input',
          name: 'orgName',
          placeholder: '组织名称'
        },
        {
          type: 'j-select',
          name: 'problemType',
          dictCode: 'feedback_type',
          placeholder: '问题类型'
        },
        {
          type: 'j-select',
          name: 'status',
          dictCode: 'flow_state',
          placeholder: '流程状态'
        },
      ],
      columns: [
        { type: 'checkbox', width: 60, fixed: 'left' },
        {
          title: '工单编号',
          field: 'workOrderCode',
          minWidth: 100,
          fixed: 'left',
          slots: { default: 'detail' }
        },
        {
          title: '问题类别',
          minWidth: 100,
          field: 'problemType',
          slots: { default: 'problemType' }
        },
        {
          title: '订单号',
          minWidth: 100,
          field: 'orderCode'
        },
        // {
        //   title: '标题',
        //   minWidth: 100,
        //   field: 'title'
        // },
        {
          title: '客户编号',
          minWidth: 100,
          field: 'customerCode'
        },
        {
          title: '客户名称',
          minWidth: 100,
          field: 'customerName'
        },
        {
          title: '所属组织编号',
          minWidth: 100,
          field: 'organizationCode'
        },
        {
          title: '所属组织名称',
          minWidth: 100,
          field: 'organizationName'
        },
        {
          title: '客户负责人编号',
          minWidth: 120,
          field: 'userCode'
        },
        {
          title: '客户负责人',
          minWidth: 100,
          field: 'userName'
        },
        {
          title: '提交时间',
          minWidth: 100,
          field: 'createTime'
        },
        {
          title: '处理时间',
          minWidth: 100,
          field: 'updateTime'
        },
        {
          title: '状态',
          align: 'center',
          minWidth: 120,
          fixed: 'right',
          slots: { default: 'status' }
        },
        {
          title: '操作',
          align: 'center',
          minWidth: 120,
          fixed: 'right',
          slots: { default: 'action' }
        }
      ],
      url: {
        list:window._CONFIG['domianDmsURL'] + '/customerfeedback/DmsCustomerFeedback/findPageList',
        // detail: window._CONFIG['domianURL'] + '/product/cnProductFloorPrice/getInfo',
        delete: window._CONFIG['domianURL'] + '/product/cnProductFloorPrice/delete',
        deleteBatch: '/product/cnProductFloorPrice/deleteBatch',
        exportXlsUrl: '/test/cn-formDemo/exportXls'
      }
    }
  },
  created() {

  },
  methods:{
    handleEdit:async function(row) {
      this.$refs.modalForm.title='编辑'
      this.$refs.modalForm.edit(row)
      this.$refs.modalForm.disableSubmit = false
    },
  }
}
</script>

<style scoped>
@import '~@assets/less/common.less';
</style>
